import random
coin = 5000 #金币

ran=random.randint(1,101)
while 1:
    if coin <= 0: #金币数量小于等于零
        print("金币数量消耗完，游戏结束")
        break
    guessNumber = int(input("请输入猜测的数字\n"))
    if guessNumber > ran:
        print("你猜测的数字大了！")
        coin-=500
    elif guessNumber < ran:
        print("你猜测的数字小了！")
        coin -= 500
    elif ran == guessNumber:
        print("恭喜你猜中，本轮幸运数字：{}!".format(ran))
        break